/*
 * TCSS 360 - Winter 2014
 * TESK Software
 */

package view.Papers;

import javax.swing.JPanel;

import view.MainFrame;
import view.userProfile.SubProgramChairView;

import javax.swing.JList;
import java.awt.Font;
import javax.swing.AbstractListModel;
import java.awt.BorderLayout;
import javax.swing.border.BevelBorder;
import javax.swing.JLabel;
import java.awt.FlowLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.GridLayout;
import java.awt.Color;
import javax.swing.border.CompoundBorder;
import javax.swing.ListSelectionModel;


/**
 * Displays a list of the reviewers assigned to a conference.
 * 
 * @author Kon
 * @version March 20, 2014
 */

@SuppressWarnings("serial")
public class ReviewerListView extends JPanel {

	/** The frame the panel is associated with. */
	private MainFrame my_frame;
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	/**
	 * Using WindownBuilder, show a list of all reviewers.
	 * @param the_mainframe main frame
	 * @author Kon.
	 * 3/8/14
	 */
	public ReviewerListView(MainFrame the_mainframe) {
		super();
		my_frame = the_mainframe;

		setForeground(Color.WHITE);
		setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
		setLayout(new BorderLayout(0, 0));
		
		JPanel northPanel = new JPanel();
		northPanel.setBorder(new CompoundBorder());
		FlowLayout fl_northPanel = (FlowLayout) northPanel.getLayout();
		fl_northPanel.setAlignment(FlowLayout.LEFT);
		add(northPanel, BorderLayout.NORTH);
		
		JLabel lblReviewers = new JLabel("Reviewers: ");
		northPanel.add(lblReviewers);
		lblReviewers.setFont(new Font("Urdu Typesetting", Font.PLAIN, 18));
		
		JPanel centerPanel = new JPanel();
		add(centerPanel, BorderLayout.CENTER);
		centerPanel.setLayout(new GridLayout(0, 3, 0, 0));
		centerPanel.setBackground(Color.white);
		
		final JList reviewList = new JList();
		reviewList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		centerPanel.add(reviewList);
		reviewList.setVisibleRowCount(10);
		reviewList.setModel(new AbstractListModel() {
			String[] values = new String[] {};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		reviewList.setFont(new Font("Tahoma", Font.PLAIN, 14));
		
		JPanel southPanel = new JPanel();
		add(southPanel, BorderLayout.SOUTH);
		
		
		JButton backButton = new JButton("Ok");
		backButton.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				SubProgramChairView panel = new SubProgramChairView(my_frame);
				my_frame.setNewPanel(panel);
				}
		});
		
		southPanel.add(backButton);
		
	}
	
}
